﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1Input;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_PhuTungTaiSan : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("CboDonViTinh")]
        private ComboBox _CboDonViTinh;
        [AccessedThroughProperty("CboPhuTung")]
        private ComboBox _CboPhuTung;
        [AccessedThroughProperty("CmdCancel")]
        private Button _CmdCancel;
        [AccessedThroughProperty("CmdOK")]
        private Button _CmdOK;
        [AccessedThroughProperty("CmdThemDM")]
        private Button _CmdThemDM;
        [AccessedThroughProperty("GroupBox4")]
        private GroupBox _GroupBox4;
        [AccessedThroughProperty("Label1")]
        private Label _Label1;
        [AccessedThroughProperty("Label12")]
        private Label _Label12;
        [AccessedThroughProperty("Label17")]
        private Label _Label17;
        [AccessedThroughProperty("Label2")]
        private Label _Label2;
        [AccessedThroughProperty("Label4")]
        private Label _Label4;
        [AccessedThroughProperty("Label9")]
        private Label _Label9;
        [AccessedThroughProperty("TxtDienGiai")]
        private TextBox _TxtDienGiai;
        [AccessedThroughProperty("txtDonGia")]
        private C1NumericEdit _txtDonGia;
        [AccessedThroughProperty("TxtSoLuong")]
        private C1NumericEdit _TxtSoLuong;
        [AccessedThroughProperty("TxtThanhTien")]
        private C1NumericEdit _TxtThanhTien;
        private DataView cFrmData;
        private string cFrmFormat;
        private string cFrmKhoa;
        private string cFrmKhoaOld;
        public string cFrmKhoaPhuTung;
        public string cFrmKhoaTaiSan;
        private string cFrmTask;
        private IContainer components;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mEnableControl;
        private clsDMThongTinTaiSanCoDinh objDMTTTSCD;
        public string pKhoaDoiTuong;
        private string strKhoaDonVi;

        public Frm_PhuTungTaiSan()
        {
            base.Load += new EventHandler(this.Frm_DMThongTinTaiSanCoDinh_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.pKhoaDoiTuong = "";
            this.cFrmKhoaOld = "";
            this.cFrmKhoa = "";
            this.cFrmKhoaTaiSan = "";
            this.cFrmKhoaPhuTung = "";
            this.cFrmTask = "";
            this.mAllowEdit = true;
            this.mAllowDel = false;
            this.objDMTTTSCD = new clsDMThongTinTaiSanCoDinh();
            this.InitializeComponent();
        }

        private void CboPhuTung_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.CboPhuTung.SelectedValue), "", modGeneral.TypeOfValue.Nothing).ToString().Trim() == "")
            {
                this.CboDonViTinh.Text = "";
            }
            else
            {
                string pKhoa = this.CboPhuTung.SelectedValue.ToString();
                clsDM_PhuTungTaiSan san = new clsDM_PhuTungTaiSan();
                san.Load(pKhoa);
                this.CboDonViTinh.Text = san.KhoaDonViTinh;
                this.strKhoaDonVi = this.CboDonViTinh.Text;
                clsDMDonViTinh tinh = new clsDMDonViTinh();
                tinh.Load(this.strKhoaDonVi);
                this.CboDonViTinh.Text = tinh.TenViet;
            }
        }

        public bool CheckIvalid()
        {
            if (this.CboPhuTung.Text.Trim() == "")
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn phải chọn t\x00ean phụ t\x00f9ng!", ""));
                this.CboPhuTung.Focus();
                return false;
            }
            return true;
        }

        private void CmdCancel_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void CmdOK_Click(object sender, EventArgs e)
        {
            if (LVYModule.ReturnIfNull(this.cFrmKhoa, "", modGeneral.TypeOfValue.Nothing).ToString().Trim() == "")
            {
                this.cFrmKhoa = modGeneral.CreatKey("FA_ChiTietPhuTungTaiSan", 15, "");
            }
            if (this.CheckIvalid())
            {
                clsDMThongTinTaiSanCoDinh objDMTTTSCD = this.objDMTTTSCD;
                objDMTTTSCD.Khoa = this.cFrmKhoa;
                objDMTTTSCD.KhoaTaiSan = this.cFrmKhoaTaiSan;
                objDMTTTSCD.KhoaPhuTung = Conversions.ToString(this.CboPhuTung.SelectedValue);
                objDMTTTSCD.DonGia = Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.txtDonGia.Value), 0, modGeneral.TypeOfValue.Nothing));
                objDMTTTSCD.DienGiai = this.TxtDienGiai.Text;
                objDMTTTSCD.SoLuong = Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.TxtSoLuong.Value), 0, modGeneral.TypeOfValue.Nothing));
                objDMTTTSCD.ThanhTien = Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.TxtThanhTien.Value), 0, modGeneral.TypeOfValue.Nothing));
                if (objDMTTTSCD.Save(this.cFrmTask))
                {
                    objDMTTTSCD = null;
                    this.Dispose();
                }
            }
        }

        private void CmdThemDM_Click(object sender, EventArgs e)
        {
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        public void FormatNumber()
        {
            LVYModule.advFormatNumber(this.txtDonGia, this.cFrmFormat);
            LVYModule.advFormatNumber(this.TxtSoLuong, this.cFrmFormat);
            LVYModule.advFormatNumber(this.TxtThanhTien, this.cFrmFormat);
        }

        private void Frm_DMThongTinTaiSanCoDinh_Load(object sender, EventArgs e)
        {
            this.EnableControl = true;
            BuildComboModule.BuildCombo(this.CboPhuTung, modGeneral.ListDanhMuc.TenPhuTung, false, "", "");
            BuildComboModule.BuildCombo(this.CboDonViTinh, modGeneral.ListDanhMuc.DonViTinh, false, "", "");
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_PhuTungTaiSan));
            this.GroupBox4 = new GroupBox();
            this.CmdThemDM = new Button();
            this.TxtThanhTien = new C1NumericEdit();
            this.Label2 = new Label();
            this.TxtSoLuong = new C1NumericEdit();
            this.txtDonGia = new C1NumericEdit();
            this.Label1 = new Label();
            this.CboDonViTinh = new ComboBox();
            this.CboPhuTung = new ComboBox();
            this.TxtDienGiai = new TextBox();
            this.Label12 = new Label();
            this.Label9 = new Label();
            this.Label17 = new Label();
            this.Label4 = new Label();
            this.CmdCancel = new Button();
            this.CmdOK = new Button();
            this.GroupBox4.SuspendLayout();
            ((ISupportInitialize) this.TxtThanhTien).BeginInit();
            ((ISupportInitialize) this.TxtSoLuong).BeginInit();
            ((ISupportInitialize) this.txtDonGia).BeginInit();
            this.SuspendLayout();
            this.GroupBox4.BackColor = Color.Transparent;
            this.GroupBox4.Controls.Add(this.CmdThemDM);
            this.GroupBox4.Controls.Add(this.TxtThanhTien);
            this.GroupBox4.Controls.Add(this.Label2);
            this.GroupBox4.Controls.Add(this.TxtSoLuong);
            this.GroupBox4.Controls.Add(this.txtDonGia);
            this.GroupBox4.Controls.Add(this.Label1);
            this.GroupBox4.Controls.Add(this.CboDonViTinh);
            this.GroupBox4.Controls.Add(this.CboPhuTung);
            this.GroupBox4.Controls.Add(this.TxtDienGiai);
            this.GroupBox4.Controls.Add(this.Label12);
            this.GroupBox4.Controls.Add(this.Label9);
            this.GroupBox4.Controls.Add(this.Label17);
            this.GroupBox4.Controls.Add(this.Label4);
            Point point = new Point(6, 6);
            this.GroupBox4.Location = point;
            this.GroupBox4.Name = "GroupBox4";
            Size size = new Size(0x1a5, 0xa2);
            this.GroupBox4.Size = size;
            this.GroupBox4.TabIndex = 0x21;
            this.GroupBox4.TabStop = false;
            this.GroupBox4.Text = "Th\x00f4ng tin li\x00ean hệ";
            point = new Point(0x16f, 0x17);
            this.CmdThemDM.Location = point;
            this.CmdThemDM.Name = "CmdThemDM";
            size = new Size(0x18, 0x17);
            this.CmdThemDM.Size = size;
            this.CmdThemDM.TabIndex = 0x7f;
            this.CmdThemDM.Text = "...";
            this.CmdThemDM.UseVisualStyleBackColor = true;
            this.TxtThanhTien.DataType = typeof(double);
            this.TxtThanhTien.FormatType = FormatTypeEnum.Currency;
            point = new Point(0x11f, 0x56);
            this.TxtThanhTien.Location = point;
            this.TxtThanhTien.Name = "TxtThanhTien";
            size = new Size(0x67, 20);
            this.TxtThanhTien.Size = size;
            this.TxtThanhTien.TabIndex = 4;
            this.TxtThanhTien.Tag = null;
            this.TxtThanhTien.VisibleButtons = DropDownControlButtonFlags.None;
            this.Label2.AutoSize = true;
            point = new Point(0xdf, 90);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            size = new Size(0x3a, 13);
            this.Label2.Size = size;
            this.Label2.TabIndex = 0x7e;
            this.Label2.Text = "Th\x00e0nh tiền";
            this.Label2.TextAlign = ContentAlignment.TopRight;
            this.TxtSoLuong.DataType = typeof(double);
            this.TxtSoLuong.FormatType = FormatTypeEnum.Currency;
            point = new Point(0x11f, 0x37);
            this.TxtSoLuong.Location = point;
            this.TxtSoLuong.Name = "TxtSoLuong";
            size = new Size(0x67, 20);
            this.TxtSoLuong.Size = size;
            this.TxtSoLuong.TabIndex = 2;
            this.TxtSoLuong.Tag = null;
            this.TxtSoLuong.VisibleButtons = DropDownControlButtonFlags.None;
            this.txtDonGia.DataType = typeof(double);
            this.txtDonGia.FormatType = FormatTypeEnum.Currency;
            point = new Point(0x65, 0x56);
            this.txtDonGia.Location = point;
            this.txtDonGia.Name = "txtDonGia";
            size = new Size(0x62, 20);
            this.txtDonGia.Size = size;
            this.txtDonGia.TabIndex = 3;
            this.txtDonGia.Tag = null;
            this.txtDonGia.VisibleButtons = DropDownControlButtonFlags.None;
            this.Label1.AutoSize = true;
            point = new Point(8, 90);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            size = new Size(0x2c, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 0x7b;
            this.Label1.Text = "Đơn gi\x00e1";
            this.Label1.TextAlign = ContentAlignment.TopRight;
            this.CboDonViTinh.Enabled = false;
            this.CboDonViTinh.FormattingEnabled = true;
            point = new Point(0x65, 0x37);
            this.CboDonViTinh.Location = point;
            this.CboDonViTinh.Name = "CboDonViTinh";
            size = new Size(0x62, 0x15);
            this.CboDonViTinh.Size = size;
            this.CboDonViTinh.TabIndex = 1;
            this.CboPhuTung.FormattingEnabled = true;
            point = new Point(0x65, 0x18);
            this.CboPhuTung.Location = point;
            this.CboPhuTung.Name = "CboPhuTung";
            size = new Size(0x108, 0x15);
            this.CboPhuTung.Size = size;
            this.CboPhuTung.TabIndex = 0;
            point = new Point(0x65, 0x75);
            this.TxtDienGiai.Location = point;
            this.TxtDienGiai.Name = "TxtDienGiai";
            size = new Size(0x121, 20);
            this.TxtDienGiai.Size = size;
            this.TxtDienGiai.TabIndex = 5;
            this.Label12.AutoSize = true;
            point = new Point(9, 120);
            this.Label12.Location = point;
            this.Label12.Name = "Label12";
            size = new Size(0x30, 13);
            this.Label12.Size = size;
            this.Label12.TabIndex = 0x63;
            this.Label12.Text = "Diễn giải";
            this.Label9.AutoSize = true;
            point = new Point(0xe0, 60);
            this.Label9.Location = point;
            this.Label9.Name = "Label9";
            size = new Size(0x31, 13);
            this.Label9.Size = size;
            this.Label9.TabIndex = 0x61;
            this.Label9.Text = "Số lượng";
            this.Label17.AutoSize = true;
            point = new Point(8, 0x3b);
            this.Label17.Location = point;
            this.Label17.Name = "Label17";
            size = new Size(60, 13);
            this.Label17.Size = size;
            this.Label17.TabIndex = 0x54;
            this.Label17.Text = "Đơn vị t\x00ednh";
            this.Label4.AutoSize = true;
            point = new Point(8, 0x1c);
            this.Label4.Location = point;
            this.Label4.Name = "Label4";
            size = new Size(0x36, 13);
            this.Label4.Size = size;
            this.Label4.TabIndex = 0x43;
            this.Label4.Text = "Phụ T\x00f9ng";
            this.CmdCancel.DialogResult = DialogResult.Cancel;
            this.CmdCancel.Image = (Image) manager.GetObject("CmdCancel.Image");
            this.CmdCancel.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x15c, 0xae);
            this.CmdCancel.Location = point;
            this.CmdCancel.Name = "CmdCancel";
            size = new Size(0x4f, 0x18);
            this.CmdCancel.Size = size;
            this.CmdCancel.TabIndex = 7;
            this.CmdCancel.Text = "&Tho\x00e1t";
            this.CmdCancel.UseVisualStyleBackColor = true;
            this.CmdOK.Image = (Image) manager.GetObject("CmdOK.Image");
            this.CmdOK.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x108, 0xae);
            this.CmdOK.Location = point;
            this.CmdOK.Name = "CmdOK";
            size = new Size(0x4e, 0x18);
            this.CmdOK.Size = size;
            this.CmdOK.TabIndex = 6;
            this.CmdOK.Text = "&Chọn";
            this.CmdOK.UseVisualStyleBackColor = true;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            this.BackgroundImage = ACCOUNTING.My.Resources.Resources.background;
            size = new Size(0x1b3, 0xca);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.CmdCancel);
            this.Controls.Add(this.CmdOK);
            this.Controls.Add(this.GroupBox4);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.Name = "Frm_PhuTungTaiSan";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "PHU TUNG TAI SAN CO DINH";
            this.GroupBox4.ResumeLayout(false);
            this.GroupBox4.PerformLayout();
            ((ISupportInitialize) this.TxtThanhTien).EndInit();
            ((ISupportInitialize) this.TxtSoLuong).EndInit();
            ((ISupportInitialize) this.txtDonGia).EndInit();
            this.ResumeLayout(false);
        }

        public void ShowData(string pKhoa)
        {
            if (LVYModule.ReturnIfNull(this.cFrmKhoaPhuTung, "", modGeneral.TypeOfValue.Nothing).ToString().Trim() != "")
            {
                clsDMThongTinTaiSanCoDinh objDMTTTSCD = this.objDMTTTSCD;
                if (objDMTTTSCD.Load(pKhoa))
                {
                    this.CboPhuTung.Text = objDMTTTSCD.KhoaPhuTung.Trim();
                    this.TxtDienGiai.Text = objDMTTTSCD.DienGiai.Trim();
                    this.txtDonGia.Value = objDMTTTSCD.DonGia;
                    this.TxtSoLuong.Value = objDMTTTSCD.SoLuong;
                    this.TxtThanhTien.Value = objDMTTTSCD.ThanhTien;
                    objDMTTTSCD = null;
                }
            }
        }

        private void TxtThanhTien_LostFocus(object sender, EventArgs e)
        {
            double num2 = 0.0;
            double num = 0.0;
            num2 = Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.TxtSoLuong.Value), 0, modGeneral.TypeOfValue.Nothing));
            num = Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.txtDonGia.Value), 0, modGeneral.TypeOfValue.Nothing));
            this.TxtThanhTien.Value = num2 * num;
        }

        internal virtual ComboBox CboDonViTinh
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboDonViTinh;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CboDonViTinh = value;
            }
        }

        internal virtual ComboBox CboPhuTung
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboPhuTung;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CboPhuTung_SelectedIndexChanged);
                if (this._CboPhuTung != null)
                {
                    this._CboPhuTung.SelectedIndexChanged -= handler;
                }
                this._CboPhuTung = value;
                if (this._CboPhuTung != null)
                {
                    this._CboPhuTung.SelectedIndexChanged += handler;
                }
            }
        }

        internal virtual Button CmdCancel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdCancel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdCancel_Click);
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click -= handler;
                }
                this._CmdCancel = value;
                if (this._CmdCancel != null)
                {
                    this._CmdCancel.Click += handler;
                }
            }
        }

        internal virtual Button CmdOK
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdOK;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdOK_Click);
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click -= handler;
                }
                this._CmdOK = value;
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click += handler;
                }
            }
        }

        internal virtual Button CmdThemDM
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdThemDM;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdThemDM_Click);
                if (this._CmdThemDM != null)
                {
                    this._CmdThemDM.Click -= handler;
                }
                this._CmdThemDM = value;
                if (this._CmdThemDM != null)
                {
                    this._CmdThemDM.Click += handler;
                }
            }
        }

        public bool EnableControl
        {
            get
            {
                return this.mEnableControl;
            }
            set
            {
                this.mEnableControl = value;
                this.CboPhuTung.Enabled = value;
                this.TxtSoLuong.ReadOnly = !value;
                this.txtDonGia.ReadOnly = !value;
                this.TxtDienGiai.ReadOnly = !value;
                this.TxtThanhTien.ReadOnly = !value;
                this.CboDonViTinh.Enabled = value;
                this.CmdOK.Enabled = value;
                this.CmdCancel.Enabled = value;
            }
        }

        internal virtual GroupBox GroupBox4
        {
            [DebuggerNonUserCode]
            get
            {
                return this._GroupBox4;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._GroupBox4 = value;
            }
        }

        internal virtual Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual Label Label12
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label12;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label12 = value;
            }
        }

        internal virtual Label Label17
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label17;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label17 = value;
            }
        }

        internal virtual Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual Label Label4
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label4;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label4 = value;
            }
        }

        internal virtual Label Label9
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label9;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label9 = value;
            }
        }

        internal virtual TextBox TxtDienGiai
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtDienGiai;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtDienGiai = value;
            }
        }

        internal virtual C1NumericEdit txtDonGia
        {
            [DebuggerNonUserCode]
            get
            {
                return this._txtDonGia;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._txtDonGia = value;
            }
        }

        internal virtual C1NumericEdit TxtSoLuong
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtSoLuong;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtSoLuong = value;
            }
        }

        internal virtual C1NumericEdit TxtThanhTien
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtThanhTien;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.TxtThanhTien_LostFocus);
                if (this._TxtThanhTien != null)
                {
                    this._TxtThanhTien.LostFocus -= handler;
                }
                this._TxtThanhTien = value;
                if (this._TxtThanhTien != null)
                {
                    this._TxtThanhTien.LostFocus += handler;
                }
            }
        }
    }
}

